home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Comunicatii / htttrack / httrack-3.32-2.exe / {app} / src / htsglobal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-05-08  |  10.3 KB  |  532 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. Please visit our Website: http://www.httrack.com
  29. */
  30.  
  31.  
  32. /* ------------------------------------------------------------ */
  33. /* File: Global #define file                                    */
  34. /* Author: Xavier Roche                                         */
  35. /* ------------------------------------------------------------ */
  36.  
  37. // Fichier rΘunissant l'ensemble des defines
  38.  
  39. #ifndef HTTRACK_GLOBAL_DEFH
  40. #define HTTRACK_GLOBAL_DEFH
  41.  
  42. // Version
  43. #define HTTRACK_VERSION      "3.32-2"
  44. #define HTTRACK_VERSIONID    "3.32.02"
  45. #define HTTRACK_AFF_VERSION  "3.x"
  46. //#define HTTRACK_AFF_WARNING  "This is a BETA release of WinHTTrack Website Copier ("HTTRACK_VERSION")\nPlease report any crashes, bugs or problems"
  47.  
  48. #ifndef HTS_NOINCLUDES
  49. #ifndef _WIN32_WCE
  50. #include <stdio.h>
  51. #include <stdlib.h>
  52. #else
  53. #include <stdio.h>
  54. #include <stdlib.h>
  55. #include "cecompat.h"
  56. #endif
  57. #endif
  58.  
  59. // DΘfinition plate-forme
  60. #include "htssystem.h"
  61. #include "htsconfig.h"
  62.  
  63. // WIN32 types
  64. #ifdef _WIN32
  65. #ifndef SIZEOF_LONG
  66. #define SIZEOF_LONG 4
  67. #define SIZEOF_LONG_LONG 8
  68. #endif
  69. #endif
  70.  
  71.  
  72. // config.h
  73. #ifdef _WIN32
  74.  
  75. // WIN32
  76. #ifndef _WIN32_WCE
  77.  
  78. #define HAVE_SYS_STAT_H 1
  79. #define HAVE_SYS_TYPES_H 1
  80. #define HAVE_SYS_STAT_H 1
  81. #ifndef DLLIB
  82. #define DLLIB 1
  83. #endif
  84. #ifndef HTS_INET6
  85. #define HTS_INET6 1
  86. #endif
  87. #ifndef S_ISREG
  88. #define S_ISREG(m) ((m) & _S_IFREG)
  89. #endif
  90.  
  91. #else
  92.  
  93. // Win32CE
  94. #define HTS_SPARE_MEMORY 1
  95. #undef DLLIB   // LoadLibrary(libssl) crashes
  96. #define NOSTRDEBUG 1
  97. #undef HTS_MAKE_KEYWORD_INDEX
  98. #undef HAVE_SYS_STAT_H
  99. #undef HAVE_SYS_TYPES_H
  100. #define HTS_DLOPEN 0
  101. #undef HTS_INET6
  102. #ifndef S_ISREG
  103. #define S_ISREG(m) ((m) & _S_IFREG)
  104.  
  105. #define stricmp _stricmp
  106. #define strdup _strdup
  107.  
  108.  
  109. #endif
  110.  
  111. #endif
  112.  
  113. #else
  114.  
  115. #include "config.h"
  116.  
  117. #ifndef FTIME
  118. #define HTS_DO_NOT_USE_FTIME
  119. #endif
  120.  
  121. #ifndef SETUID
  122. #define HTS_DO_NOT_USE_UID
  123. #endif
  124.  
  125. #ifndef HTS_LONGLONG
  126. #ifdef SIZEOF_LONG_LONG
  127. #if SIZEOF_LONG_LONG==8
  128. #define HTS_LONGLONG 1
  129. #endif
  130. #endif
  131.  
  132. #ifndef HTS_LONGLONG
  133. #ifdef __sun
  134. #define HTS_LONGLONG 0
  135. #endif
  136. #ifdef __osf__
  137. #define HTS_LONGLONG 0
  138. #endif
  139. #ifdef __linux
  140. #define HTS_LONGLONG 1
  141. #endif
  142. #ifdef _WIN32
  143. #define HTS_LONGLONG 1
  144. #endif
  145. #endif
  146. #endif
  147.  
  148. #ifdef DLLIB
  149. #define HTS_DLOPEN 1
  150. #else
  151. #define HTS_DLOPEN 0
  152. #endif
  153.  
  154. #endif
  155.  
  156. // Socket windows ou socket unix
  157. #ifdef _WIN32
  158. #undef HTS_PLATFORM
  159. #define HTS_PLATFORM 1
  160. #define HTS_WIN 1
  161.  
  162. #else
  163.  
  164. #define HTS_WIN 0
  165. #ifdef __linux
  166. #undef HTS_PLATFORM
  167. #define HTS_PLATFORM 3
  168. #endif
  169. #endif
  170.  
  171. // don't spare memory usage by default
  172. #ifndef HTS_SPARE_MEMORY
  173. #define HTS_SPARE_MEMORY 0
  174. #endif
  175.  
  176. // compatibilitΘ DOS
  177. #if HTS_WIN
  178. #define HTS_DOSNAME 1
  179. #else
  180. #define HTS_DOSNAME 0
  181. #endif
  182.  
  183. // utiliser zlib?
  184. #ifndef HTS_USEZLIB
  185. // autoload
  186. #define HTS_USEZLIB 1
  187. #endif
  188.  
  189. #ifndef HTS_INET6
  190. #define HTS_INET6 0
  191. #endif
  192.  
  193. // utiliser openssl?
  194. #ifndef HTS_USEOPENSSL
  195. // autoload
  196. #define HTS_USEOPENSSL 1
  197. #endif
  198.  
  199. #ifndef HTS_DLOPEN
  200. #define HTS_DLOPEN 1
  201. #endif
  202.  
  203. #ifndef HTS_USESWF
  204. #define HTS_USESWF 1
  205. #endif
  206.  
  207. #if HTS_WIN
  208. #else
  209. #define __cdecl
  210. #endif
  211.  
  212. #ifdef HTS_ANALYSTE_CONSOLE
  213. #undef HTS_ANALYSTE_CONSOLE
  214. #define HTS_ANALYSTE_CONSOLE 1
  215. #endif
  216.  
  217. #if HTS_ANALYSTE
  218. #else
  219. #if HTS_WIN
  220. #else
  221. #undef HTS_ANALYSTE
  222. // Analyste
  223. #define HTS_ANALYSTE 1
  224. #define HTS_ANALYSTE_CONSOLE 1
  225. #endif
  226. #endif
  227.  
  228.  
  229. /* rc file */
  230. #if HTS_WIN
  231. #define HTS_HTTRACKRC "httrackrc"
  232. #else
  233.  
  234. #ifndef HTS_ETCPATH
  235. #define HTS_ETCPATH "/etc"
  236. #endif
  237. #ifndef HTS_BINPATH
  238. #define HTS_BINPATH "/usr/bin"
  239. #endif
  240. #ifndef HTS_LIBPATH
  241. #define HTS_LIBPATH "/usr/lib"
  242. #endif
  243. #ifndef HTS_PREFIX
  244. #define HTS_PREFIX "/usr"
  245. #endif
  246.  
  247. #define HTS_HTTRACKRC ".httrackrc"
  248. #define HTS_HTTRACKCNF HTS_ETCPATH"/httrack.conf"
  249.  
  250. #ifdef DATADIR
  251. #define HTS_HTTRACKDIR DATADIR"/httrack/"
  252. #else
  253. #define HTS_HTTRACKDIR HTS_PREFIX"/share/httrack/"
  254. #endif
  255.  
  256. #endif
  257.  
  258. #if HTS_SPARE_MEMORY==0
  259. /* Gestion des tables de hashage */
  260. #define HTS_HASH_SIZE 20147
  261. /* Taille max d'une URL */
  262. #define HTS_URLMAXSIZE 1024
  263. /* Taille max ligne de commande (>=HTS_URLMAXSIZE*2) */
  264. #define HTS_CDLMAXSIZE 1024
  265. #else
  266. /* Gestion des tables de hashage */
  267. #define HTS_HASH_SIZE 1023
  268. /* Taille max d'une URL */
  269. #define HTS_URLMAXSIZE 256
  270. /* Taille max ligne de commande (>=HTS_URLMAXSIZE*2) */
  271. #define HTS_CDLMAXSIZE 1024
  272. #endif
  273.  
  274. /* Copyright (C) Xavier Roche and other contributors */
  275. #define HTTRACK_AFF_AUTHORS "[XR&CO'2004]"
  276. #define HTS_DEFAULT_FOOTER "<!-- Mirrored from %s%s by HTTrack Website Copier/"HTTRACK_AFF_VERSION" "HTTRACK_AFF_AUTHORS", %s -->"
  277. #define HTTRACK_WEB "http://www.httrack.com"
  278. #define HTS_UPDATE_WEBSITE "http://www.httrack.com/update.php3?Product=HTTrack&Version="HTTRACK_VERSIONID"&VersionStr="HTTRACK_VERSION"&Platform=%d&Language=%s"
  279.  
  280. #define H_CRLF "\x0d\x0a"
  281. #define CRLF   "\x0d\x0a"
  282. #if HTS_WIN
  283. #define LF "\x0d\x0a"
  284. #else
  285. #define LF "\x0a"
  286. #endif
  287.  
  288. /* Θquivaut α "paramΦtre vide", par exemple -F (none) */
  289. #define HTS_NOPARAM "(none)"
  290. #define HTS_NOPARAM2 "\"(none)\""
  291.  
  292. /* maximum et minimum */
  293. #define maximum(A,B) ( (A) > (B) ? (A) : (B) )
  294. #define minimum(A,B) ( (A) < (B) ? (A) : (B) )
  295.  
  296. /* chaine vide? */
  297. #define strnotempty(A) (((A)[0]!='\0') ? 1 : 0)
  298.  
  299. /* optimisation inline si possible */
  300. #ifdef __cplusplus
  301. #define HTS_INLINE inline
  302. #else
  303. #define HTS_INLINE
  304. #endif
  305.  
  306. #ifdef _WIN32
  307. #ifdef LIBHTTRACK_EXPORTS
  308. #define HTSEXT_API __declspec(dllexport)
  309. #else
  310. #define HTSEXT_API __declspec(dllimport)
  311. #endif
  312. #else
  313. #define HTSEXT_API 
  314. #endif
  315.  
  316. #ifndef HTS_LONGLONG
  317. #ifdef HTS_NO_64_BIT
  318. #define HTS_LONGLONG 0
  319. #else
  320. #define HTS_LONGLONG 1
  321. #endif
  322. #endif
  323.  
  324. // long long int? (or int)
  325. // (and int cast for system functions like malloc() )
  326.  
  327. #if HTS_LONGLONG
  328. #ifdef LLINT_FORMAT
  329.   typedef LLINT_TYPE LLint;
  330.   typedef LLINT_TYPE TStamp;
  331.   #define LLintP LLINT_FORMAT
  332. #else
  333.  #if HTS_WIN
  334.   typedef __int64 LLint;
  335.   typedef __int64 TStamp;
  336.   #define LLintP "%I64d"
  337.  #else
  338.  #if HTS_PLATFORM==0
  339.   typedef long long int LLint;
  340.   typedef long long int TStamp;
  341.   #define LLintP "%lld"
  342.  #else
  343.   typedef long long int LLint;
  344.   typedef long long int TStamp;
  345.   #define LLintP "%Ld"
  346.  #endif
  347.  #endif
  348. #endif
  349. #else
  350.  typedef int LLint;
  351.  #define LLintP "%d"
  352.  typedef double TStamp;
  353. #endif
  354.  
  355. #ifdef LFS_FLAG
  356. typedef LLint INTsys;
  357. #define INTsysP LLintP
  358. #ifdef __linux
  359. #define HTS_FSEEKO
  360. #endif
  361. #else
  362. typedef int INTsys;
  363. #define INTsysP "%d"
  364. #endif
  365.  
  366. /* Default alignement */
  367. #ifndef HTS_ALIGN
  368. #define HTS_ALIGN (sizeof(void*))
  369. #endif
  370.  
  371. /* IPV4, IPV6 and various unified structures */
  372. #define HTS_MAXADDRLEN 64
  373.  
  374. #if HTS_WIN
  375. #else
  376. #define __cdecl 
  377. #endif
  378.  
  379. /* mode pour mkdir ET chmod (accΦs aux fichiers) */
  380. #define HTS_PROTECT_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR)
  381. #if HTS_ACCESS
  382. #define HTS_ACCESS_FILE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
  383. #define HTS_ACCESS_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
  384. #else
  385. #define HTS_ACCESS_FILE (S_IRUSR|S_IWUSR)
  386. #define HTS_ACCESS_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR)
  387. #endif
  388.  
  389. /* vΘrifier la dΘclaration des variables prΘprocesseur */
  390. #ifndef HTS_DOSNAME
  391. #error | HTS_DOSNAME Has not been defined.
  392. #error | Set it to 1 if you are under DOS, 0 under Unix.
  393. #error | Example: place this line in you source, before includes:
  394. #error | #define HTS_DOSNAME 0
  395. #error
  396. #error
  397. #endif
  398. #ifndef HTS_ACCESS
  399. /* Par dΘfaut, accΦs α tous les utilisateurs */
  400. #define HTS_ACCESS 1
  401. #endif
  402.  
  403. /* fflush sur stdout */
  404. #define io_flush { fflush(stdout); fflush(stdin); }
  405.  
  406.  
  407.  
  408. /* HTSLib */
  409.  
  410. // Cache DNS, accΘlΦre les rΘsolution d'adresses
  411. #define HTS_DNSCACHE 1
  412.  
  413. // ID d'une pseudo-socket locale pour les file://
  414. #define LOCAL_SOCKET_ID -500000
  415.  
  416. // taille de chaque buffer (10 sockets 650 ko)
  417. #if HTS_SPARE_MEMORY==0
  418. #define TAILLE_BUFFER 65536
  419. #else
  420. #define TAILLE_BUFFER 8192
  421. #endif
  422.  
  423. #if HTS_WIN
  424. #else
  425. // use pthreads.h
  426.  
  427. #ifndef THREADS
  428. #define HTS_DO_NOT_USE_PTHREAD
  429. #endif
  430.  
  431. #ifdef HTS_DO_NOT_USE_PTHREAD
  432. #define USE_PTHREAD 0
  433. #else
  434. #define USE_PTHREAD 1
  435. #endif
  436. #endif
  437.  
  438. #if HTS_WIN
  439. #define USE_BEGINTHREAD 1
  440. #else
  441. #if USE_PTHREAD
  442. #define USE_BEGINTHREAD 1
  443. #else
  444. /* sh*t.. */
  445. #define USE_BEGINTHREAD 0
  446. #endif
  447. #endif
  448.  
  449. #ifdef _DEBUG
  450. // trace mallocs
  451. //#define HTS_TRACE_MALLOC
  452. #ifdef HTS_TRACE_MALLOC
  453. typedef unsigned long int t_htsboundary;
  454. typedef struct _mlink {
  455.   char* adr;
  456.   int len;
  457.   int id;
  458.   struct _mlink* next;
  459. } mlink;
  460. static const t_htsboundary htsboundary = 0xDEADBEEF;
  461. #endif
  462. #endif
  463.  
  464. /* strxxx debugging */
  465. #ifndef NOSTRDEBUG
  466. #define STRDEBUG 1
  467. #endif
  468.  
  469.  
  470. /* ------------------------------------------------------------ */
  471. /* Debugging                                                    */
  472. /* ------------------------------------------------------------ */
  473.  
  474. // dΘbuggage types
  475. #define DEBUG_SHOWTYPES 0
  476. // backing debug
  477. #define BDEBUG 0
  478. // chunk receive
  479. #define CHUNKDEBUG 0
  480. // realloc links debug
  481. #define MDEBUG 0
  482. // cache debug
  483. #define DEBUGCA 0
  484. // DNS debug
  485. #define DEBUGDNS 0
  486. // savename debug
  487. #define DEBUG_SAVENAME 0
  488. // debug robots
  489. #define DEBUG_ROBOTS 0
  490. // debug hash
  491. #define DEBUG_HASH 0
  492. // VΘrification d'intΘgritΘ
  493. #define DEBUG_CHECKINT 0
  494. // nbr sockets debug
  495. #define NSDEBUG 0
  496.  
  497. // dΘbuggage HTSLib
  498. #define HDEBUG 0
  499. // surveillance de la connexion
  500. #define CNXDEBUG 0
  501. // debuggage cookies
  502. #define DEBUG_COOK 0
  503. // dΘbuggage hard..
  504. #define HTS_WIDE_DEBUG 0
  505. // debuggage deletehttp et cie
  506. #define HTS_DEBUG_CLOSESOCK 0
  507. // debug tracage mΘmoire
  508. #define MEMDEBUG 0
  509.  
  510. // htsmain
  511. #define DEBUG_STEPS 0
  512.  
  513.  
  514. // DΘbuggage de contr⌠le
  515. #if HTS_DEBUG_CLOSESOCK
  516. #define _HTS_WIDE 1
  517. #endif
  518. #if HTS_WIDE_DEBUG
  519. #define _HTS_WIDE 1
  520. #endif
  521. #if _HTS_WIDE
  522. extern FILE* DEBUG_fp;
  523. #define DEBUG_W(A)  { if (DEBUG_fp==NULL) DEBUG_fp=fopen("bug.out","wb"); fprintf(DEBUG_fp,":>"A); fflush(DEBUG_fp); }
  524. #undef _
  525. #define _ ,
  526. #endif
  527.  
  528.  
  529.  
  530. #endif
  531.  
  532.